<template>
	<view>
		<u-tabbar :value="tabBarIndex" @change="tabBarChange" :fixed="true" :placeholder="true" activeColor="#d81e06" :safeAreaInsetBottom="true" safeAreaInsetBottom>
			<u-tabbar-item :text="item.text" :icon="item.icon" v-for="(item, index) in list" :key="index"></u-tabbar-item>
		</u-tabbar>
	</view>
</template>

<script>
export default {
	data() {
		return {
			value4: 0,
			list: [
				{
					text: '首页',
					pagePath: '/pages/index/index',
					icon: 'home'
				},
				{
					text: '分类',
					pagePath: '/pages/topic/topic',
					icon: 'file-text'
				},
				{
					text: '专题',
					pagePath: '/pages/special/special',
					icon: 'grid'
				},
				{
					text: '购物车',
					pagePath: '/pages/cart/cart',
					icon: 'shopping-cart'
				},
				{
					text: '我的',
					pagePath: '/pages/user/user',
					icon: 'account'
				}
			]
		};
	},
	computed: {
		tabBarIndex() {
			return this.$store.state.tabBarIndex;
		}
	},
	methods: {
		tabBarChange(idx) {
			// this.value4 = idx
			uni.switchTab({
				url: this.list[idx].pagePath
			});
		}
	}
};
</script>

<style></style>
